<?php

require_once('data/SugarBean.php');
require_once('modules/DocumentRevisions/DocumentRevision.php');

class UpdateRevision {
	function UpdateRevision(&$bean, $event, $arguments)
	{
		// only transfer the task type if this document is newly created
		if($bean->date_entered == $bean->date_modified){
			$latest_revision = new DocumentRevision();
			$latest_revision->retrieve($bean->document_revision_id);
			$latest_revision->task_type = $_REQUEST['task_type'];
			$latest_revision->document_id = $bean->id;
			$latest_revision->save();
		}
	}
}

?>
